package ee.falcon.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ee.falcon.gui.frame.NewOrEditProfileFrame;
import ee.falcon.gui.frame.ProfilesFrame;
import ee.falcon.xml.ProfileInfoList;
import ee.falcon.xml.SpecificProfileInfo;

public class NewOrEditButtonListener implements ActionListener
{
	private boolean isEditProfileFrame; //if not, then it is NewProfileFrame; 
	private NewOrEditProfileFrame newOrEditProfileFrame; 
	private ProfilesFrame profilesFrame; 
	private SpecificProfileInfo jListSelection; 
	private ProfileInfoList profileInfoList;  
	
	public NewOrEditButtonListener(boolean isEditProfileFrame, ProfileInfoList profileInfoList,
			ProfilesFrame profileFrame)
	{
		this.profilesFrame = profileFrame;  
		this.profileInfoList = profileInfoList; 
		this.isEditProfileFrame = isEditProfileFrame; 
	}

	@Override
	public void actionPerformed(ActionEvent e) 
	{
		newOrEditProfileFrame = new NewOrEditProfileFrame(isEditProfileFrame, 
				profileInfoList, profilesFrame.getSpecificProfileInfoJListSelection(), profilesFrame); 
		newOrEditProfileFrame.setVisible(true); 
	}
	
	public boolean getIsEditProfileFrame()
	{
		return this.isEditProfileFrame; 
	}
	
	public void setIsEditProfileFrame(boolean trueOrFalse)
	{
		this.isEditProfileFrame = trueOrFalse;
	}
	
	public void setNewOrEditProfileFrame(NewOrEditProfileFrame newOrEditProfileFrame)
	{
		this.newOrEditProfileFrame = newOrEditProfileFrame;
	}
	
	public NewOrEditProfileFrame getNewOrEditProfileFrame()
	{
		return this.newOrEditProfileFrame;
	}
	
	public ProfilesFrame getprofilesFrame()
	{
		return this.profilesFrame;
	}
	
	public SpecificProfileInfo getJListSelection()
	{
		return this.jListSelection; 
	}
	
	public void setJListSelection(SpecificProfileInfo specificProfileInfo)
	{
		this.jListSelection = specificProfileInfo;
	}
	
	public ProfileInfoList getProfileInfoList()
	{
		return this.profileInfoList; 
	}

}
